﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:thicknessEditor="clr-namespace:Glass.Basics.ExtendedWPFTookit.ThicknessEditor"
    xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
    xmlns:sliderControl="clr-namespace:Glass.Basics.ExtendedWPFTookit.SliderControl">
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/Glass.Basics.ExtendedWPFToolkit;component/Themes/Resources.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="{x:Type thicknessEditor:ThicknessEditor}">
        <Setter Property="MinWidth" Value="140" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type thicknessEditor:ThicknessEditor}">
                    <ControlTemplate.Resources>
                        <Style TargetType="{x:Type xctk:DoubleUpDown}">
                            <Setter Property="Minimum" Value="0" />
                            <Setter Property="MinWidth" Value="30" />
                        </Style>
                    </ControlTemplate.Resources>
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                        <Border.Resources>
                            <Style TargetType="{x:Type DockPanel}">
                                <Setter Property="MinWidth" Value="70" />
                            </Style>
                        </Border.Resources>
                        <UniformGrid Rows="2" Columns="2">
                            <UniformGrid.Resources>
                                <Style TargetType="{x:Type Grid}">
                                    <Setter Property="Margin" Value="2" />
                                    <Setter Property="Width" Value="8" />
                                    <Setter Property="Height" Value="8" />
                                    <Setter Property="VerticalAlignment" Value="Center" />
                                </Style>
                            </UniformGrid.Resources>
                            <DockPanel>
                                <Grid Background="{StaticResource LeftArrow}" />
                                <xctk:DoubleUpDown Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=ThicknessLeft, UpdateSourceTrigger=PropertyChanged}" />
                            </DockPanel>
                            <DockPanel>
                                <Grid Background="{StaticResource LeftArrow}">
                                    <Grid.LayoutTransform>
                                        <RotateTransform Angle="90" />
                                    </Grid.LayoutTransform>
                                </Grid>
                                <xctk:DoubleUpDown Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=ThicknessTop, UpdateSourceTrigger=PropertyChanged}" />
                            </DockPanel>
                            <DockPanel>
                                <Grid Background="{StaticResource LeftArrow}">
                                    <Grid.LayoutTransform>
                                        <RotateTransform Angle="180" />
                                    </Grid.LayoutTransform>
                                </Grid>
                                <xctk:DoubleUpDown Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=ThicknessRight, UpdateSourceTrigger=PropertyChanged}"/>
                            </DockPanel>
                            <DockPanel>
                                <Grid Background="{StaticResource LeftArrow}">
                                    <Grid.LayoutTransform>
                                        <RotateTransform Angle="270" />
                                    </Grid.LayoutTransform>
                                </Grid>
                                <xctk:DoubleUpDown Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=ThicknessBottom, UpdateSourceTrigger=PropertyChanged}" />
                            </DockPanel>
                        </UniformGrid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style TargetType="{x:Type sliderControl:SliderControl}">
        <Setter Property="MinWidth" Value="100"/>
        <Setter Property="Height" Value="30"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type sliderControl:SliderControl}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" VerticalAlignment="Center">
                        <DockPanel MinWidth="150">
                            <Slider Width="150" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay, Path=Value, UpdateSourceTrigger=PropertyChanged}" 
                                    DockPanel.Dock="Left" Minimum="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MinValue}" 
                                    Maximum="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=MaxValue}" SmallChange="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=SmallChange}"/>
                            <TextBox VerticalContentAlignment="Center" TextWrapping="Wrap" 
                                     Text="{Binding RelativeSource={RelativeSource TemplatedParent},StringFormat=G, Mode=TwoWay, Path=Value, UpdateSourceTrigger=PropertyChanged}" MaxWidth="96" DockPanel.Dock="Right" Margin="5,0,0,0"/>
                        </DockPanel>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



</ResourceDictionary>
